import React from 'react';

class Com extends React.Component {
    render () {
        let placeholder = this.props.placeholder || '请输入提示信息'
        let type = this.props.type || 'text'
        let clear = this.props.clear || false
        let errortip = this.props.errortip || ''
        let label = this.props.label || ''
        return (
            <div className="inputbox">
                <label>{label}</label>
                <input type={type} placeholder={placeholder} value={this.props.value} ref="test" onChange={ (event) => {
                    this.props.onChange(event.target.value)
                }}/>
                {/* { clear && this.props.value.length > 0 ? <button onClick={ () => {
                    this.props.onChange('')
                }} className="shanchu">x</button> : ''} */}
                <p>{errortip}</p>
            </div>
        )
    }
}

export default Com;